package com.app.repository.impl;

import com.app.model.main.MessageRecord;
import com.app.repository.interfaces.MessageRecordMapper;
import com.app.support.dao.MybatisDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Lichaojie on 2017/5/7. It's a beautiful day.
 */
@Repository
public class MessageRecordMapperImpl implements MessageRecordMapper {

    private String prefix = "com.app.dao.main.MessageRecordMapper";

    @Autowired
    private MybatisDao mybatisDao;


    @Override
    public int deleteByPrimaryKey(Long id){
        return mybatisDao.delete(prefix,".deleteByPrimaryKey",id);
    }

    @Override
    public int insert(MessageRecord record){
        return mybatisDao.insert(prefix,".insert",record);
    }

    @Override
    public int insertSelective(MessageRecord record){
        return mybatisDao.insert(prefix, ".insertSelective", record);
    }

    @Override
    public MessageRecord selectByPrimaryKey(Long id){
        return mybatisDao.get(prefix, ".selectByPrimaryKey", id);
    }

    @Override
    public int updateByPrimaryKeySelective(MessageRecord record){
        return mybatisDao.update(prefix, ".updateByPrimaryKeySelective", record);
    }

    @Override
    public int updateByPrimaryKey(MessageRecord record){
        return mybatisDao.update(prefix, ".updateByPrimaryKey", record);
    }

    @Override
    public List<MessageRecord> selectByReceiverId(long receiverId){
        return mybatisDao.get(prefix, ".selectByReceiverId", receiverId);
    }

    @Override
    public List<MessageRecord> selectBySenderId(long senderId){
        return mybatisDao.get(prefix,".selectBySenderId",senderId);
    }
}
